package view 
{
	import model.data.NPCTypes;
	import view.viewComponents.NPC;
	/**
	 * ...
	 * @author Gaz Williams
	 * simple factory for creating npc's
	 * set the graphic references animation and x and y coords in here...
	 */
	
	// loads of [embeds] here...
	public class NPCFactory 
	{
		[Embed(source="../../embedded/monitor.png")]
		private static var MonitorTexture:Class;
		
		[Embed(source="../../embedded/table.png")]
		private static var TableTexture:Class;
		
		[Embed(source="../../embedded/rat.png")]
		private static var RatTexture:Class;
		
		[Embed(source="../../embedded/fridge.png")]
		private static var FridgeTexture:Class;
		
		[Embed(source="../../embedded/microwave.png")]
		private static var MicrowaveTexture:Class;
		
		[Embed(source="../../embedded/printer.png")]
		private static var PrinterTexture:Class;
		
		[Embed(source="../../embedded/trophy.png")]
		private static var TrophyTexture:Class;
		
		[Embed(source="../../embedded/bin.png")]
		private static var BinTexture:Class;
		
		[Embed(source="../../embedded/watercooler.png")]
		private static var CoolerTexture:Class;
		
		public static function createFromType(npcRequested:NPCTypes):NPC
		{
			var npc:NPC = new NPC(npcRequested, 32); 
			npc.solid = false;
			
			//factory method based on type
			switch (npcRequested.type) 
			{
				case NPCTypes.BROKEN_MONITOR: // 1
					npc.loadGraphic(MonitorTexture, true, false, 32, 32, true);
					
					npc.addAnimation("broken", [1]);
					npc.play("broken");
					
					npc.column = 2;
					npc.row = 3;
				break;
				case NPCTypes.DEAD_RAT: // 2
					npc.loadGraphic(RatTexture, false, false, 32, 32, true);
					//addAnimation();
					npc.column = 2;
					npc.row = 5;
				break;
				case NPCTypes.WASTE_BIN: //3
					npc.loadGraphic(BinTexture, false, false, 32, 32, true);
					//addAnimation();
					npc.column = 2;
					npc.row = 9;
				break;
				case NPCTypes.FRIDGE: //4
					npc.loadGraphic(FridgeTexture, false, false, 32, 32, true);
					npc.column = 2;
					npc.row = 11;
				break;
				case NPCTypes.BROKEN_TABLE: //5
					npc.loadGraphic(TableTexture, true, false, 32, 32, true);
					
					npc.addAnimation("broken", [1]);
					npc.play("broken");
					
					npc.column = 3;
					npc.row = 12;
				break;
				case NPCTypes.WATER_COOLER: //6
					npc.loadGraphic(CoolerTexture, true, false, 32, 32, true);
					
					npc.addAnimation("broken", [0, 1], 2, true);
					npc.play("broken");
					
					npc.column = 5;
					npc.row = 12;
				break;
				case NPCTypes.PRINTER: //7
					npc.loadGraphic(PrinterTexture, true, false, 32, 32, true);
					
					npc.addAnimation("broken2", [0, 1], 2, true);
					npc.play("broken2");
					
					npc.column = 7;
					npc.row = 12;
				break;
				case NPCTypes.MICROWAVE: //8
					npc.loadGraphic(MicrowaveTexture, true, false, 32, 32, true);
					
					npc.addAnimation("broken", [0,1], 2, true);
					npc.play("broken");
					
					npc.column = 9;
					npc.row = 12;
				break;
				case NPCTypes.TROPHY: //9
					npc.loadGraphic(TrophyTexture, false, false, 32, 32, true);
					//addAnimation();
					npc.column = 11;
					npc.row = 12;
				break;
			}
			
			return npc;
		}
	}

}